{template '_header'}

<div class="page-header">
    当前位置：<span class="text-primary">店主管理</span>
</div>

<div class="page-content">

<form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">
    <input type="hidden" name="c" value="site" />
    <input type="hidden" name="a" value="entry" />
    <input type="hidden" name="m" value="mx_shop" />
    <input type="hidden" name="do" value="web" />
    <input type="hidden" name="r" value="mendian.list.manage" />

    <div class="page-toolbar">

        <div class="col-sm-7">
            <div class="btn-group btn-group-sm" style='float:left'>
                <button class="btn btn-default btn-sm"  type="button" data-toggle='refresh'><i class='fa fa-refresh'></i></button>
            </div>
        </div>

        <div class="col-sm-5 pull-right">
            <div class="input-group">
                <div class="input-group-select">
                    <select name='searchfield' class='form-control  input-sm select-md' style="width:120px;"  >
                        <option value="member" {if $_GPC['searchfield']=='member'}selected{/if}>会员信息</option>
                        <option value="mendian" {if $_GPC['searchfield']=='mendian'}selected{/if}>门店名称</option>
                        <option value="address" {if $_GPC['searchfield']=='address'}selected{/if}>区域</option>
                    </select>
                </div>
                <input type="text" class="form-control input-sm"  name="keyword" value="{$_GPC['keyword']}" placeholder="请输入关键词"/>
                <span class="input-group-btn">

                <button class="btn btn-sm btn-primary" type="submit"> 搜索</button>
            </span>
            </div>
        </div>
    </div>
</form>

{if count($list)>0}
<table class="table table-hover table-responsive">
    <thead class="navbar-inner" >
    <tr>
        <th style='width:80px;'>店主名称</th>
        <th style='width:80px;'>头像</th>
        <th style='width:80px;'>电话</th>
        <th style='width:80px;'>店主所在地</th>
        <th style='width:80px;'>门店</th>
        <th style='width:80px;'>订单</th>
        <th style='width:80px;'>累计佣金</th>
        <th style='width:80px;'>操作</th>
    </tr>
    </thead>
    <tbody>
    {loop $list $row}
    <tr>
        <td >
            <span>
                <a {ifp 'user.list.view'}href="{php echo webUrl('user/list/detail',array('id'=>$row['mid']))}" target='_blank'{/if}>
                    {if !empty($row['realname'])} {$row['realname']}{/if}
                </a>
            </span>
        </td>

        <td >
            <img src="{$row['avatar']}" style="width:70px;">
        </td>

        <td >
            <span>{$row['mobile']}</span>
        </td>

        <td >
            <span>{if !empty($row['province'])} {$row['province']} {if !empty($row['city'])} - {$row['city']}{/if} {/if}</span>
        </td>

        <td >
            <span><a {ifp 'mendian.main'}href="{php echo webUrl('mendian', array('maid'=>$row['manageid']))}"{/if}>{$row['mendian']} 家</a></span>
        </td>

        <td >
            <span><a {ifp 'serverbonus.order.main'}href="{php echo webUrl('serverorder/order/all', array('inorder'=>1,'searchfield'=>'member','keyword'=>$row['nickname']))}"{/if}>{$row['order']} 笔</a></span>
        </td>

        <td >
            {ifp 'serverbonus.commission.commlog'}
                {if !empty($row['comid'])}
                <span><a href="{php echo webUrl('serverorder/commission/commlog', array('id'=>$row['comid']))}">{$row['comm']} 元</a></span>
                {else}
                <span>{$row['comm']} 元</span>
                {/if}
            {else}
                <span>{$row['comm']} 元</span>
            {/if}
        </td>

        <td style="overflow:visible;">
            <div class="btn-group btn-group-sm" >
                    {ifp 'user.list.detail'}
                    <a class="btn btn-default btn-sm" href="{php echo webUrl('user/list/detail',array('id' => $row['mid']));}" title="会员详情"><i class='fa fa-edit'></i> 会员</a>
                    {/if}

                    {ifp 'mendian.main'}
                    <a class="btn btn-default btn-sm" href="{php echo webUrl('mendian',array('maid'=>$row['manageid']))}" title='门店列表'><i class='fa fa-list'></i> 门店</a>
                    {/if}

                    {ifp 0 && 'mendian.order.main'}
                    <a class="btn btn-default btn-sm" href="{php echo webUrl('serverorder/order/all', array('inorder'=>1,'searchfield'=>'member','keyword'=>$row['nickname']))}" title='订单'><i class='fa fa-credit-card'></i> 订单</a>
                    {/if}

                    {ifp 0 && 'serverbonus.commission.commlog'}
                        {if !empty($row['comid'])}
                        <a class="btn btn-default btn-sm" href="{php echo webUrl('serverorder/commission/commlog', array('id'=>$row['comid']))}" title='佣金明细'><i class='fa fa-money'></i> 佣金</a>
                        {/if}
                    {/if}
            </div>
        </td>
    </tr>

    {/loop}

    </tbody>

</table>

{$pager}

{else}
<div class="panel panel-default">
    <div class="panel-body empty-data">未查询到相关数据</div>
</div>
{/if}
</div>
<script language="javascript">

    require(['bootstrap'],function(){
        $("[rel=pop]").popover({
            trigger:'manual',
            placement : 'left',
            title : $(this).data('title'),
            html: 'true',
            content : $(this).data('content'),
            animation: false
        }).on("mouseenter", function () {
            var _this = this;
            $(this).popover("show");
            $(this).siblings(".popover").on("mouseleave", function () {
                $(_this).popover('hide');
            });
        }).on("mouseleave", function () {
            var _this = this;
            setTimeout(function () {
                if (!$(".popover:hover").length) {
                    $(_this).popover("hide")
                }
            }, 100);
        });
    });

</script>

{template '_footer'}